<?php
declare(strict_types=1);

namespace Zyucv7\Core\Error;

use Zyucv7\Core\Error\Handler\Error AS ErrorHandler;
use Zyucv7\Core\Error\Handler\Exception AS ExceptionHandler;

/**
 * @description 错误处理主程序
 * @package Zyucv7\Core\Error
 */
class Error
{
    private static $errorhandle_instance = null;
    private static $exceptionhandle_instance = null;

    public static function init()
    {
        // 初始化全局错误处理
        self::$errorhandle_instance = new ErrorHandler();
        self::$errorhandle_instance->register();
        // 初始化全局异常处理
        self::$exceptionhandle_instance = new ExceptionHandler();
        self::$exceptionhandle_instance->register();
    }

    public static function trigger($message)
    {
        trigger_error($message, E_USER_ERROR);
    }
}
?>